import click
import frappe
import logging
from frappe.custom.doctype.custom_field.custom_field import create_custom_fields


CUSTOM_FIELDS = {
    "Sales Order": [
		# 定制shipping_address_name字段,其它属性不变，修改[允许提交后修改]属性为true        
		{
			"allow_on_submit": 1,
			"fieldname": "shipping_address_name",
			"fieldtype": "Link",
			"hide_days": 1,
			"hide_seconds": 1,
			"label": "Shipping Address Name",
			"options": "Address",
			"print_hide": 1
		},
		{
			"allow_on_submit": 1,
			"fieldname": "customer_address",
			"fieldtype": "Link",
			"hide_days": 1,
			"hide_seconds": 1,
			"label": "Customer Address",
			"options": "Address",
			"print_hide": 1
		},
    ],
}


def after_migrate():
	frappe.logger("teo_custom").info("执行了teo_custom中的migrate方法")
	create_custom_fields(CUSTOM_FIELDS, ignore_validate=True)
